<?php $values = json_decode($site['vals']); ?>
<!DOCTYPE HTML>
<html>
  <head>
	<?php echo Yaf_View_Simple::render("header.phtml"); ?>
    <script type="text/javascript" src="/asset/admin/js/fileinput.js"></script>
    <link type="text/css" rel="stylesheet" href="/asset/admin/css/fileinput.css" />
  </head>
    <body>
	  <?php echo Yaf_View_Simple::render("menu.phtml"); ?>
	  <div class="container">
	    <div class="content">
		  <form role="form" class="form-horizontal" id="beform" action="update">
		    <input type="hidden" name="id" id="id" value="<?php echo $site['id'] ?>"/>
		    <fieldset>
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="option">Option:</label>
			    <div class="col-lg-6">
				  <input type="text" name="option" class="form-control" id="option" value="<?php echo $site['options']; ?>"/>
			    </div>
			  </div>            
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="title">Title:</label>
			    <div class="col-lg-6">
				  <input type="text" name="title" class="form-control" id="title" value="<?php echo $values->title; ?>"/>
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="logo">Logo:</label>
			    <div class="col-lg-10">
                  <img class="img-thumbnail" src="<?php echo $values->logo ?>"/>
                  <input id="logo" type="hidden" name="logo"  value="<?php echo $values->logo ?>" >
                  <input id="input-id" type="file" class="file" data-preview-file-type="text" >
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="keyword">Keyword:</label>
			    <div class="col-lg-4">
				  <input type="text" name="keyword" class="form-control" id="keyword" value="<?php echo $values->keyword; ?>"/>
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="description">Description:</label>
			    <div class="col-lg-6">
				  <textarea name="Description" class="form-control" id="description" rows="5"><?php echo $values->description; ?></textarea>
			    </div>
			  </div>
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="copyright">Copyright:</label>
			    <div class="col-lg-6">
				  <textarea name="copyright" class="form-control" id="copyright" rows="5">
                    <?php echo $values->copyright; ?>
                  </textarea>
			    </div>
			  </div>					
			  <div class="form-group">
			    <label class="col-lg-2 control-label" for="ipc">IPC:</label>
			    <div class="col-lg-6">
				  <input type="text" name="ipc" class="form-control" id="ipc" value="<?php echo $values->ipc; ?>"/>
			    </div>
			  </div>						
		      <div class="form-group">
		        <label class="col-lg-2 control-label"></label>
		        <div class="col-lg-6">
		          <a  href="javascript:def.submit('#beform',null)" class="btn btn-primary">Submit</a>
		        </div>
              </div>
		    </fieldset>
		  </form>
	    </div>
	  </div>
	  
	  <!-- 模态框（Modal） -->
	  <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modellabel" aria-hidden="true">
	    <div class="modal-dialog">
		  <div class="modal-content">
		    <div class="modal-header bg-default">
			  <div class="modal-title" id="modallabel">
			    <h5 class="text-primary">Signal</h5>
			  </div>
		    </div>
		    <div class="modal-body bg-primary">
			  
		    </div>
		    <div class="modal-footer">
			  <button type="button" class="btn btn-default" data-dismiss="modal">Close
			  </button>
		    </div>
		  </div><!-- /.modal-content -->
	    </div><!-- /.modal -->
	  </div>		

	  <?php echo Yaf_View_Simple::render("footer.phtml"); ?>
      <script type="text/javascript">
       $("#input-id").fileinput({
           uploadUrl: '/admin/site/logo',
           showUpload: true,
           showCaption: false,
           browseClass: "btn btn-primary",
           previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
           allowedPreviewTypes: ['image'],
           allowedFileTypes: ['image'],
           allowedFileExtensions:  ['jpg', 'png','gif'],             
       }).on('fileuploaded', function(event, data) {
           /*            console.log(data.response);*/
           var file = data.response.file_data;
           /*            console.log(file);*/
           image = '/'+file.root_path+'/'+file.save_path+file.save_name;
           $("#logo").val(image);
           /*            console.log(image);*/
       });
      </script>    
  </body>
</html>
